<html>
<head><meta charset="utf-8"><title>lazy norm higher ranked paths · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html">lazy norm higher ranked paths</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203492409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/203492409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#203492409">(Jul 10 2020 at 10:39)</a>:</h4>
<p>Working on <a href="https://github.com/rust-lang/rust/issues/72129#issuecomment-627208767">https://github.com/rust-lang/rust/issues/72129#issuecomment-627208767</a></p>
<p>I have the following snippet:</p>
<div class="codehilite"><pre><span></span><code><span class="cp">#![feature(lazy_normalization_consts)]</span><span class="w"></span>
<span class="cp">#![allow(incomplete_features)]</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">Zero</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">C</span>: <span class="kt">usize</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="p">());</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Zero</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">C</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">T</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">Zero</span><span class="o">&gt;</span>::<span class="n">C</span><span class="p">]</span>: <span class="nb">Default</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>


<p>Which ends up with the following ICE:</p>
<div class="codehilite"><pre><span></span><code><span class="n">error</span>: <span class="nc">internal</span><span class="w"> </span><span class="n">compiler</span><span class="w"> </span><span class="n">error</span>: <span class="nc">src</span><span class="o">/</span><span class="n">librustc_typeck</span><span class="o">/</span><span class="n">check</span><span class="o">/</span><span class="k">mod</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">689</span>:<span class="mi">13</span>: <span class="nc">escaping</span><span class="w"> </span><span class="n">bound</span><span class="w"> </span><span class="n">vars</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">predicate</span><span class="w"> </span><span class="n">Obligation</span><span class="p">(</span><span class="n">predicate</span><span class="o">=</span><span class="n">WellFormed</span><span class="p">(</span><span class="n">Foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">),</span><span class="w"> </span><span class="n">depth</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span><span class="w"></span>
<span class="w">  </span><span class="o">-</span>-&gt; <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">lcnr</span><span class="o">/</span><span class="n">rust3</span><span class="o">/</span><span class="n">src</span><span class="o">/</span><span class="n">test</span><span class="o">/</span><span class="n">ui</span><span class="o">/</span><span class="n">__check</span><span class="o">/</span><span class="k">const</span><span class="o">-</span><span class="n">ty</span><span class="o">-</span><span class="n">hrtb</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">16</span>:<span class="mi">19</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="n">LL</span><span class="w"> </span><span class="o">|</span><span class="w">     </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">Zero</span><span class="o">&gt;</span>::<span class="n">C</span><span class="p">]</span>: <span class="nb">Default</span><span class="p">;</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">                   </span><span class="o">^^^^^^^</span><span class="w"></span>
</code></pre></div>



<a name="203492896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/203492896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#203492896">(Jul 10 2020 at 10:46)</a>:</h4>
<p>Looks like I have to look into why the following already works fine, even if <code>'b</code> is not bound in the type of <code>Foo&lt;'b&gt;</code> here</p>
<div class="codehilite"><pre><span></span><code><span class="cp">#![feature(lazy_normalization_consts)]</span><span class="w"></span>
<span class="cp">#![allow(incomplete_features)]</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">Zero</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">C</span>: <span class="kt">usize</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="k">type</span> <span class="nc">T</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="p">());</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Zero</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">C</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span>

<span class="w">    </span><span class="k">type</span> <span class="nc">T</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="mi">0</span><span class="p">];</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">T</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;b</span><span class="o">&gt;</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Foo</span><span class="o">&lt;</span><span class="na">&#39;b</span><span class="o">&gt;</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">Zero</span><span class="o">&gt;</span>::<span class="n">T</span>: <span class="nb">Default</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>



<a name="203498732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/203498732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#203498732">(Jul 10 2020 at 12:09)</a>:</h4>
<p>Minimized:</p>
<div class="codehilite"><pre><span></span><code><span class="cp">#![feature(lazy_normalization_consts)]</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Bar</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="p">());</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Bar</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">ok</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">usize</span> <span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">6</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">Bar</span>::<span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span>::<span class="n">ok</span><span class="p">()</span><span class="w"> </span><span class="p">}]</span>:<span class="p">;</span><span class="w"></span>
</code></pre></div>



<a name="203498953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/203498953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#203498953">(Jul 10 2020 at 12:12)</a>:</h4>
<p>I think it is kind of dangerous to just not emit WF predicates here <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="203499034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/203499034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#203499034">(Jul 10 2020 at 12:13)</a>:</h4>
<p>Do we have to refactor wf_check to currently deal with hrtb and change <code>Predicate::WellFormed</code> to use a binder?</p>



<a name="203499573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/203499573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#203499573">(Jul 10 2020 at 12:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths/near/203499034">said</a>:</p>
<blockquote>
<p>Do we have to refactor wf_check to currently deal with hrtb and change <code>Predicate::WellFormed</code> to use a binder?</p>
</blockquote>
<p>yeah, there are also some other problems <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span> seems like I can't just fix this in a few hours.</p>



<a name="203499970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/203499970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#203499970">(Jul 10 2020 at 12:23)</a>:</h4>
<p>The problem here is that</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">Bar</span>::<span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span>::<span class="n">ok</span><span class="p">()</span><span class="w"> </span><span class="p">}]</span>: <span class="nb">Sized</span><span class="p">;</span><span class="w"></span>
</code></pre></div>


<p>becomes</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">Foo</span>::<span class="n">Anon</span><span class="p">]</span>: <span class="nb">Sized</span>
<span class="nc">const</span><span class="w"> </span><span class="n">Foo</span>::<span class="n">Anon</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w">  </span><span class="n">Bar</span>::<span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span>::<span class="n">ok</span><span class="p">();</span><span class="w"> </span><span class="c1">// `&#39;a` is not in scope!</span>
</code></pre></div>


<p>impl Trait also has this problem and works around it by adding a generic to the opaque type. For constants this would look like this:</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">Foo</span>::<span class="n">Anon</span>::<span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="p">]</span>: <span class="nb">Sized</span>
<span class="nc">const</span><span class="w"> </span><span class="n">Foo</span>::<span class="n">Anon</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w">  </span><span class="n">Bar</span>::<span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span>::<span class="n">ok</span><span class="p">();</span><span class="w"> </span><span class="c1">// `&#39;a` is a `ReEarlyBound` here</span>
</code></pre></div>



<a name="210131753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/210131753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hameer Abbasi <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#210131753">(Sep 15 2020 at 13:51)</a>:</h4>
<p>Is this something I could help fix, or is it a bit advanced for me right now?</p>



<a name="217553422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217553422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217553422">(Nov 22 2020 at 14:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span> is there something stopping us from treating higher ranked lifetimes as free regions in the constant?</p>



<a name="217553618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217553618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217553618">(Nov 22 2020 at 14:25)</a>:</h4>
<p>I'm not sure what you mean.</p>



<a name="217553634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217553634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217553634">(Nov 22 2020 at 14:25)</a>:</h4>
<p>so when we have</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">Bar</span>::<span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span>::<span class="n">ok</span><span class="p">()</span><span class="w"> </span><span class="p">}]</span>: <span class="nb">Sized</span><span class="p">;</span><span class="w"></span>
</code></pre></div>



<a name="217553694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217553694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217553694">(Nov 22 2020 at 14:26)</a>:</h4>
<p>my idea was to treat <code>'a</code> in the anon const as a latebound lifetime so that we don't have to explicitly add a new generic param to the anon const</p>



<a name="217553718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217553718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217553718">(Nov 22 2020 at 14:27)</a>:</h4>
<p>i am not yet sure if that idea even makes sense though, mostly looking into this rn and still a bit overwhelmed</p>



<a name="217555296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217555296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217555296">(Nov 22 2020 at 15:02)</a>:</h4>
<p>ok, so I think I know how to go forward here...</p>



<a name="217555304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217555304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217555304">(Nov 22 2020 at 15:03)</a>:</h4>
<ol>
<li>add a <code>generics: Generics&lt;'hir&gt;</code> field to <code>hir::AnonConst</code></li>
</ol>



<a name="217555322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217555322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217555322">(Nov 22 2020 at 15:03)</a>:</h4>
<ol start="2">
<li>use that in <code>generics_of</code></li>
</ol>



<a name="217555345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217555345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217555345">(Nov 22 2020 at 15:03)</a>:</h4>
<ol start="3">
<li>in ast_lowering, pretty much copy what we are doing for async return types and add all lifetimes as generic params when lowering consts</li>
</ol>



<a name="217555481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217555481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217555481">(Nov 22 2020 at 15:06)</a>:</h4>
<p>That sounds plausible.</p>



<a name="217564572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217564572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217564572">(Nov 22 2020 at 19:00)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span>  opened <a href="https://github.com/rust-lang/rust/issues/79313">#79313</a> but that still has quite a few bugs and issues.</p>
<p>I intend to work on this for the next few weeks during which I hopefully get this ready.</p>



<a name="217564599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217564599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217564599">(Nov 22 2020 at 19:01)</a>:</h4>
<p>assigned you for review but it really isn't finished yet, so there's no pressure for you to look at it for now</p>



<a name="217564627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217564627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217564627">(Nov 22 2020 at 19:02)</a>:</h4>
<p>will ping you once it's fairly ready</p>



<a name="217645513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217645513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217645513">(Nov 23 2020 at 15:56)</a>:</h4>
<p>well, looks like it works, still have to do some cleanup and there are some remaining issues here</p>



<a name="217645575"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217645575" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217645575">(Nov 23 2020 at 15:57)</a>:</h4>
<p>one annoyance is</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">test</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">whatever</span><span class="p">()]</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>



<a name="217645648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217645648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217645648">(Nov 23 2020 at 15:57)</a>:</h4>
<p>we now lower this to</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">const</span><span class="w"> </span><span class="n">ANON_CT</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">whatever</span><span class="p">();</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">test</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">ANON_CT</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="p">]</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>



<a name="217645705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217645705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217645705">(Nov 23 2020 at 15:58)</a>:</h4>
<p>meaning that <code>'a</code> is suddenly used</p>



<a name="217645815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217645815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217645815">(Nov 23 2020 at 15:58)</a>:</h4>
<p>we also lower</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;'</span><span class="na">a</span><span class="w"> </span><span class="p">())</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;'</span><span class="na">b</span><span class="o">&gt;</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">foo</span>::<span class="o">&lt;'</span><span class="na">a</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">b</span><span class="o">&gt;</span><span class="p">()]</span>: <span class="nb">Sized</span><span class="p">;</span><span class="w"></span>
</code></pre></div>



<a name="217646082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217646082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217646082">(Nov 23 2020 at 16:00)</a>:</h4>
<p>to</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">const</span><span class="w"> </span><span class="n">ANON_CT</span><span class="o">&lt;'</span><span class="na">a</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">a</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">b</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">foo</span><span class="o">&lt;'</span><span class="na">a</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">b</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;'</span><span class="na">a</span><span class="w"> </span><span class="p">())</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;'</span><span class="na">b</span><span class="o">&gt;</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="n">ANON_CT</span><span class="o">&lt;'</span><span class="na">a</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">a</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">b</span><span class="o">&gt;</span><span class="p">]</span>: <span class="nb">Sized</span><span class="p">;</span><span class="w"></span>
</code></pre></div>



<a name="217646122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217646122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217646122">(Nov 23 2020 at 16:00)</a>:</h4>
<p>which doesn't really matter but feels a bit suboptimal</p>



<a name="217646465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217646465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217646465">(Nov 23 2020 at 16:02)</a>:</h4>
<p>oh well, looks like the second example still has a bug</p>



<a name="217646468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217646468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217646468">(Nov 23 2020 at 16:02)</a>:</h4>
<p>f</p>



<a name="217652609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217652609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217652609">(Nov 23 2020 at 16:47)</a>:</h4>
<p>oh well, looks like the second example was actually fine, I just forgot to add <code>feature(const_generics)</code></p>



<a name="217654277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217654277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217654277">(Nov 23 2020 at 17:00)</a>:</h4>
<p>this still fails :/</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">// check-pass</span>
<span class="cp">#![feature(const_generics)]</span><span class="w"></span>
<span class="cp">#![allow(incomplete_features)]</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Bar</span><span class="o">&lt;'</span><span class="na">a</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">b</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">c</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;'</span><span class="na">a</span><span class="w"> </span><span class="p">(),</span><span class="w"> </span><span class="o">&amp;'</span><span class="na">b</span><span class="w"> </span><span class="p">(),</span><span class="w"> </span><span class="o">&amp;'</span><span class="na">c</span><span class="w"> </span><span class="p">());</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">Baz</span><span class="o">&lt;'</span><span class="na">a</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">b</span><span class="p">,</span><span class="w"> </span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="p">(</span><span class="o">&amp;'</span><span class="na">a</span><span class="w"> </span><span class="p">())</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;'</span><span class="na">b</span><span class="o">&gt;</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_</span>: <span class="nb">Box</span><span class="o">&lt;</span><span class="k">dyn</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;'</span><span class="na">c</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Baz</span><span class="o">&lt;'</span><span class="na">a</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">b</span><span class="p">,</span><span class="w"> </span><span class="p">[</span><span class="kt">u8</span><span class="p">;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">_</span>: <span class="nc">Bar</span><span class="o">&lt;'</span><span class="na">a</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">b</span><span class="p">,</span><span class="w"> </span><span class="o">'</span><span class="na">c</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="mi">3</span><span class="w"></span>
<span class="w">    </span><span class="p">}]</span><span class="o">&gt;&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="mi">4</span><span class="w"></span>
<span class="p">}]</span>: <span class="nb">Sized</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>



<a name="217655296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217655296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217655296">(Nov 23 2020 at 17:07)</a>:</h4>
<p>because wf tries to add a const evaluatable predicate for the inner array which is inside of a binder</p>



<a name="217762907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217762907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217762907">(Nov 24 2020 at 14:46)</a>:</h4>
<p>well, mostly looking good now</p>
<p>still want to refactor lifetime resolution and now have to deal with some bug regarding typechecking which i still have to look into.</p>



<a name="217796448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/lazy%20norm%20higher%20ranked%20paths/near/217796448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/lazy.20norm.20higher.20ranked.20paths.html#217796448">(Nov 24 2020 at 18:40)</a>:</h4>
<p>ok, ready for review</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>